const Entity = require('../../shared/entity/Entity')
const { getAddAndRemoveIdList } = require('../../shared/repository/helper')
const R = require('ramda')
const descriptor = {
  code: { required: true, message: '角色编码不能为空' },
  name: { required: true, message: '角色名称不能为空' },
}
class Role extends Entity {
  name
  code
  description
  userList = []
  menuList = []
  constructor(data) {
    super(descriptor, data)
    this.init(data)
  }
  hasMenu() {
    return this.menuList.length > 0
  }
  hasUser() {
    return this.userList.length > 0
  }
  static create(data) {
    return new Role(data)
  }
}

module.exports = Role
